package backend;


public class FrontConsole {

	public static void main(String [] args){
		
		/*NOTA: no deberian haber try-catch en el back... s�lo en el front!*/
		
		
		String token="";
		String username="a";
		String password="12345678";
		
		
		
		//SignIn
		try{
			String resp[];
			
			resp=Security.signIn(username, password);
			
			token=resp[0];
			
			System.out.println("token: "+resp[0]);
			System.out.println("id: "+resp[1]);
			System.out.println("username: "+resp[2]);
			System.out.println("name: "+resp[3]);
			System.out.println("last_login: "+resp[4]);
		}
		catch (Exception a){
			System.out.println("SignIn Error: "+a.getMessage());
		}
		
		//SignOut
		try{
			
			Security.signOut(username, token);
			
			System.out.println("SignOut: OK");
		
		}
		catch (Exception a){
			System.out.println("SignOut Error: "+a.getMessage());
		}
		
		//ChangePassword
		try{
			
			Security.changePassword(username, password,password);
			
			System.out.println("changePassword: OK");
		
		}
		catch (Exception a){
			System.out.println("ChangePassword Error: "+a.getMessage());
		}
		
		//CreateAccount
		try{
			
			Security.createAccount("a11111", "hola", password, "asd", "2009-08-18");
			
			System.out.println("CreateAccount OK");
		

		}
		catch (Exception a){
			System.out.println("CreateAccount Error: "+a.getMessage());
		}
		
		
		
		//GetAccount
		try{
			
			
			String [] resp= Security.getAccount(username, token);
			
			System.out.println("GetAccount OK");
			System.out.println(resp[0]);
			System.out.println(resp[1]);
			System.out.println(resp[2]);
			System.out.println(resp[3]);
		
		}
		catch (Exception a){
			System.out.println("GetAccount Error: "+a.getMessage());
		}			
		
		
		//UpdateAccount
		try{
			
			
			Security.updateAccount(username, token,"emmanuel","qq","sss");
			
			System.out.println("UpdateAccount OK");
		
		}
		catch (Exception a){
			System.out.println("UpdateAccount Error: "+a.getMessage());
		}				
		
		
		try {
		    System.out.println(Catalog.getCategoryList(2));
		    System.out.println(Catalog.getSubcategoryList(1,2));
		    System.out.println(Catalog.getProductListByCategory(1,2));
		    System.out.println(Catalog.getProductListBySubcategory(1,2,8));
		    System.out.println((Catalog.getProductListByName("Bone")));
		   // System.out.println((Catalog.getProductListByName("Bone")).first().getProductInformation());
		}
		catch (Exception e) {
		    // TODO Auto-generated catch block
		    e.printStackTrace();
		}
		
	}	
}
